home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Language/OS - Multiplatform Resource Library
/
LANGUAGE OS.iso
/
et
/
et3_0-a1.lha
/
et3
/
src
/
FindChange.C
< prev
next >
Wrap
C/C++ Source or Header
|
1992-07-09
|
2KB
|
98 lines
#ifdef __GNUG__
#pragma implementation
#endif
#include "FindChange_e.h"
#include "Class.h"
#include "Application.h"
#include "FindDialog.h"
#include "ChangeDialog.h"
#include "TextView.h"
#include "MenuBar.h"
#include "Menu.h"
static ChangeDialog *changeDialog= 0;
static FindDialog *findDialog= 0;
ONEXIT(ChangeDialog)
{
//SafeDelete(changeDialog);
//SafeDelete(findDialog);
}
void FindChange::ShowFindDialog(TextView *tv)
{
if (findDialog == 0) {
findDialog= new FindDialog("Find");
gApplication->AddManager(findDialog);
}
findDialog->SetTextView(tv);
findDialog->ShowOnWindow(tv->GetWindow());
}
void FindChange::ShowChangeDialog(TextView *tv)
{
if (changeDialog == 0) {
changeDialog= new ChangeDialog("Find/Change");
gApplication->AddManager(changeDialog);
}
changeDialog->SetTextView(tv);
changeDialog->ShowOnWindow(tv->GetWindow());
}
void FindChange::FindAgain(TextView *tv)
{
if (changeDialog != 0) {
changeDialog->SetTextView(tv);
changeDialog->FindAgain();
}
else if (findDialog != 0) {
findDialog->SetTextView(tv);
findDialog->FindAgain();
}
}
void FindChange::DoSetupMenu(Menu *menu)
{
char *pattern= "";
if (changeDialog != 0)
pattern= changeDialog->GetSearchPattern();
else if (findDialog != 0)
pattern= findDialog->GetSearchPattern();
menu->EnableItem(cFINDAGAIN, strlen(pattern) != 0);
}
void FindChange::InstallFind(MenuBar *mb, TextView *tv)
{
Menu *m= mb->FindMenu(cEDITMENU);
if (m)
m->InsertItemsAfter(cLASTEDIT, "Find/Change...@F", cFIND,
"Find Again @G", cFINDAGAIN,
0);
if (tv)
tv->SetFlag(eTextWantFindFocus);
}
void FindChange::InstallChange(MenuBar *mb, TextView *tv)
{
Menu *m= mb->FindMenu(cEDITMENU);
if (m)
m->InsertItemsAfter(cLASTEDIT, "Find/Change...@F", cFIND,
"Find Again @G", cFINDAGAIN,
0);
if (tv)
tv->SetFlag(eTextWantFindFocus);
}
void FindChange::SetFocus(TextView *tv)
{
if (tv->TestFlag(eTextWantFindFocus)) {
if (changeDialog != 0)
changeDialog->SetTextView(tv);
if (findDialog != 0)
findDialog->SetTextView(tv);
}
}